Skip to content

.Net: Return result of the function executed before termination for streaming API #6428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

SergeyMenshykh
Copy link
Member

Motivation, Context and Description

Fixes: #6404

Today, the SK chat completion streaming API does not return the result of a function executed before termination, whereas the non-streaming version does return the result. This PR resolves this issue by returning the result of a function executed before termination was requested.

Contribution Checklist

@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner May 28, 2024 14:17
@SergeyMenshykh SergeyMenshykh self-assigned this May 28, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels May 28, 2024
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeyMenshykh Just for the context, I decided to not return function result in streaming termination scenario on purpose, because I wasn't sure if returning entire result as one chunk is a right approach, and function result is still accessible via ChatHistory input parameter, when using IChatCompletionService.

Based on created issue, it looks like this is expected behavior by developers, so it's probably worth to add it. Thanks for adding this!

@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue May 29, 2024
Merged via the queue into microsoft:main with commit 02145d9 May 29, 2024
17 checks passed
@SergeyMenshykh SergeyMenshykh deleted the include-function-call-result-for-streaming-api branch May 29, 2024 10:22
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
…treaming API (microsoft#6428)

### Motivation, Context and Description
Fixes: microsoft#6404

Today, the SK chat completion streaming API does not return the result
of a function executed before termination, whereas the non-streaming
version does return the result. This PR resolves this issue by returning
the result of a function executed before termination was requested.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.Net: Terminate auto function invocation with streaming does not return last function response
4 participants